import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WaresVO, WaresForm, WaresQuery, WaresDocVo, WaresDocQuery } from '@/api/wuliu/wares/types';

/**
 * 查询报单表列表
 * @param query
 * @returns {*}
 */

export const listWares = (query?: WaresQuery): AxiosPromise<WaresVO[]> => {
  return request({
    url: '/wuliu/wares/list',
    method: 'get',
    params: query
  });
};

/**
 * 订单大全
 * @param query
 * @returns {*}
 */

export const listManage = (query?: WaresDocQuery): AxiosPromise<WaresDocVo[]> => {
  return request({
    url: '/wuliu/wares/listManage',
    method: 'get',
    params: query
  });
};


export const sendMessage = (id: string | number): AxiosPromise<WaresDocVo[]> => {
  return request({
    url: '/send/message/insert/'+ id,
    method: 'get'
  });
};

/**
 * 查询报单表详细
 * @param id
 */
export const getWares = (id: string | number): AxiosPromise<WaresVO> => {
  return request({
    url: '/wuliu/wares/' + id,
    method: 'get'
  });
};

/**
 * 新增报单表
 * @param data
 */
export const addWares = (data: WaresForm) => {
  return request({
    url: '/wuliu/wares',
    method: 'post',
    data: data
  });
};

/**
 * 修改报单表
 * @param data
 */
export const updateWares = (data: WaresForm) => {
  return request({
    url: '/wuliu/wares',
    method: 'put',
    data: data
  });
};

/**
 * 修改报单表
 * @param data
 */
export const updateHdWares = (data: WaresForm) => {
  return request({
    url: '/wuliu/hdzb',
    method: 'put',
    data: data
  });
};


/**
 * 修改报单表
 * @param data
 */
export const updateHdWaresMxCcf = (data: WaresForm) => {
  return request({
    url: '/wuliu/hdzb',
    method: 'put',
    data: data
  });
};

/**
 * 删除报单表
 * @param id
 */
export const delWares = (id: string | number | Array<string | number>) => {
  return request({
    url: '/wuliu/wares/' + id,
    method: 'delete'
  });
};

export const exportWares = (data: any) => {
  return request({
    url: '/wuliu/wares/export',
    method: 'post',
    data
  });
};

export const queryKhzd = (params: any) => {
  return request({
    url: '/wuliu/wares/queryKhzd',
    method: 'get',
    params
  });
};

export const wareAllList = (params: any) => {
  return request({
    url: '/wuliu/wares/wareAlllist',
    method: 'get',
    params
  });
};

export const newfclist = (params: any) => {
  return request({
    url: '/wuliu/wares/newfclist',
    method: 'get',
    params
  });
};
